<?php
/* 
 * ebiz front
 * 
 * exchange center View
 * 
 * @author allen
 * 
 */
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
        <title>我要兑换-阿基米米网上商城</title>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/n/javascript/lib/jquery.js'></script>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/n/javascript/lib/jquery-ui-datepicker.js'></script>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/n/javascript/frontend.js'></script>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/javascript/akimimi.js'></script>
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/css/style.css' rel='stylesheet' type='text/css' />   
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/css/default.css' rel='stylesheet' type='text/css' />
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/css/myaccountleftnav.css' rel='stylesheet' type='text/css' />
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/css/myaccount.css' rel='stylesheet' type='text/css' />                  
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $GLOBALS["config"]['template_name']; ?>/css/headerAndFooter.css' rel='stylesheet' type='text/css' />
    </head>
    <body>
        <?php 
            require_once '../app/views/HeaderView.php';
            echo HeaderView::getCommonHeaderView();
        ?>
        <div id="navigation">
            <a href="/">首页</a>
            <span>></span>
            <a href="/userinfo/index">我的阿基米米</a>
             > 兑换中心
        </div>
        <div id="mymimi_body">
        <?php 
            require_once '../app/views/MyAccoutLeftNavView.php';
            echo MyAccountLeftNav::getMyAccountLeftNav();
        ?>
        <div id="mymimi_right">
        <div class="right_bj"></div>
        <div class="add_border">
	        
            <!-- begin -->
            <form method="post" id="exchangeForm" >
		    <div class="exchange_content">
		        <div class="integral_userinfo">
		            <div class="integral_userinfo_title">您目前的晋级积分：</div>
		            <div class="integral_userinfo_value"><?php echo $pointsBuyerTotal; ?></div>
		            
		            <div class="integral_userinfo_title">您目前的兑换积分：</div>
		            <div class="integral_userinfo_value"><?php echo $pointsBuyer; ?></div>
		            <div class="clear"></div>
		        </div>
		        
		        <div class="exchangx_part">
		            <!--选择兑换类型开始      1=兑换礼品，2=兑换抵用券-->
		            <div class="exchangx_type_part">
                        <div id='order_nav'>
                            <ul>
				                <li id="exchangeId2" class='title_1' onclick="javascript:ExchangeContent.show('exchangxGift', 'exchangxCoupon');">兑换礼品</li>
				                <li id="exchangeId1" class='title_2' onclick="javascript:ExchangeContent.show('exchangxCoupon', 'exchangxGift');">兑换优惠券</li>
			                </ul>
                        </div>
                        
                        <!--
                        <div class="exchangx_type">
		                    <div class="exchangx_type_select">
		                        <input id="exchangeId1" type="radio" value="1" name="exchange" checked="checked" onClick="javascript:ExchangeContent.show('exchangxGift', 'exchangxCoupon');" />
		                    </div>
		                    <div class="exchangx_type_title">
		                        <label for="exchangeId1">兑换礼品</label>
		                    </div>
		                </div>
		                <div class="exchangx_type">
		                    <div class="exchangx_type_select">
		                        <input id="exchangeId2" type="radio" name="exchange" value="2" onClick="javascript:ExchangeContent.show('exchangxCoupon', 'exchangxGift');" />
		                    </div>
		                    <div class="exchangx_type_title">
		                        <label for="exchangeId2">兑换抵用券</label>
		                    </div>
		                </div>
		                <div class="clear"></div>
                        -->
		            </div>
		            <!--选择兑换类型结束-->
		            
		            <!--选择兑换内容开始-->
		            <div class="exchangx_content_part">
                    
		                <div class="exchangx_content" id="exchangxGift">
                            <div class="exchange_title">
                                <div style="float:left;margin-left:0px;margin-top:8px;color:#000000;font-weight:bold">请选择</div>
                                <div style="float:left;margin-left:10px;margin-top:8px;color:#000000;font-weight:bold">产品图片</div>
                                <div style="float:left;margin-left:10px;margin-top:8px;color:#000000;font-weight:bold">兑换所需晋级积分</div>
                                <div style="float:left;margin-left:10px;margin-top:8px;color:#000000;font-weight:bold;">兑换消耗积分</div>
                                <div style="float:left;margin-left:80px;margin-top:8px;color:#000000;font-weight:bold">产品名称</div>
                                <div style="float:left;margin-left:160px;margin-top:8px;color:#000000;font-weight:bold;">产品描述</div>
                                <div class="clear"></div>
                            </div>
                            
                            <div id="paginate">
                        <!-- 礼品信息开始 -->
                            <?php 
                                foreach ($giftProductInfo as $key => $giftItem) {
                                	if( empty($giftItem["description"]) && !empty($giftItem["url_title"]) ){//网店中存在的产品
                                		$urlTitle = urlencode($giftItem['url_title']);
                            ?>
                            
                            <div class="exchange_item">
                                <div style="float:left;margin-top:15px;margin-left:5px;">
                                    <?php if($key == 0){ ?>
                                    <input type="radio" name="exchangeGoods" checked="checked" value="<?php echo $giftItem["id"]."-".$giftItem["min_ac_points"]."-".$giftItem["exhaust_points"]; ?>" />
                                    <?php }else{ ?>
                                    <input type="radio" name="exchangeGoods" value="<?php echo $giftItem["id"]."-".$giftItem["min_ac_points"]."-".$giftItem["exhaust_points"]; ?>" />
                                    <?php } ?>
                                </div>
                                <div style="float:left;margin-left:20px;cursor:pointer;width:60px;height:60px;" onclick="window.open('/p/<?php echo $urlTitle; ?>');">
                                    <?php if( empty($giftItem["image_path"]) ){ ?>
                                    <img style="width:60px;height:60px;" src="<?php echo ConfigConstants::getDefaultProductImagePath(60); ?>" alt="" />
                                    <?php }else{?>
                                    <img style="width:60px;height:60px;" src="<?php echo $giftItem["image_path"]; ?>" alt="" />
                                    <?php } ?>
                                </div>
                                <div style="float:left;margin-left:20px;">
                                    <div style="text-align:center;width:50px;height:30px;line-height:30px;"><?php echo $giftItem["min_ac_points"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:20px;">
                                    <div style="text-align:center;width:100px;height:30px;line-height:30px;"><?php echo $giftItem["exhaust_points"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:0px;cursor:pointer;" onclick="window.open('/p/<?php echo $urlTitle; ?>');">
                                    <div style="text-align:center;width:200px;height:30px;line-height:30px;"><?php echo $giftItem["title"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:0px;cursor:pointer;" onclick="window.open('/p/<?php echo $urlTitle; ?>');">
                                    <div style="text-align:center;width:260px;height:30px;line-height:30px;"></div>
                                </div>
                                <div class="clear"></div>
                            </div>
                            
                            <?php }else{ ?>
                                
                            <div class="exchange_item">
                                <div style="float:left;margin-top:15px;margin-left:5px;">
                                    <?php if($key == 0){ ?>
                                    <input type="radio" checked="checked" name="exchangeGoods" value="<?php echo $giftItem["id"]."-".$giftItem["min_ac_points"]."-".$giftItem["exhaust_points"]; ?>" />
                                    <?php }else{ ?>
                                    <input type="radio" name="exchangeGoods" value="<?php echo $giftItem["id"]."-".$giftItem["min_ac_points"]."-".$giftItem["exhaust_points"]; ?>" />
                                    <?php } ?>
                                </div>
                                <div style="float:left;margin-left:20px;width:60px;height:60px;">
                                    <?php if( empty($giftItem["image_path"]) ){ ?>
                                    <img style="width:60px;height:60px;" src="<?php echo ConfigConstants::getDefaultProductImagePath(60); ?>" alt="" />
                                    <?php }else{?>
                                    <img style="width:60px;height:60px;" src="<?php echo ConfigConstants::getPrivateImagePath()."/gift/".$giftItem["image_path"]; ?>" alt="" />
                                    <?php } ?>
                                </div>
                                <div style="float:left;margin-left:20px;">
                                    <div style="text-align:center;width:50px;height:30px;line-height:30px;"><?php echo $giftItem["min_ac_points"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:20px;">
                                    <div style="text-align:center;width:100px;height:30px;line-height:30px;"><?php echo $giftItem["exhaust_points"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:0px;">
                                    <div style="text-align:center;width:200px;height:30px;line-height:30px;"><?php echo $giftItem["title"]; ?></div>
                                </div>
                                <div style="float:left;margin-left:0px;">
                                    <div style="text-align:center;width:260px;height:30px;line-height:30px;"><?php echo $giftItem["description"]; ?></div>
                                </div>
                                <div class="clear"></div>
                            </div>
                                
                            <?php 
                                }
                                    } 
                            ?>
                        <!-- 礼品信息结束 -->
                        
                        <!-- 分页开始 -->
                            <div class='p2_page'><?php echo $headerPaginate; ?></div>
                        <!-- 分页结束 -->
                            </div>
                        
                        <!-- 用户填写送货地址开始 -->
	                        <div id="addAddress" style="margin-left:150px;margin-top:30px;margin-bottom:10px;">
	                            <div style="font-size:14px;font-weight:bold;margin-bottom:10px;;color:#333333;">
	                                                                        送货地址
	                            </div>
	                            <div style="margin-top:10px;">
	                                                                        收货人：&nbsp;&nbsp;&nbsp;
	                                <input id="addUserName" type="text" name="addUserName" />
	                                <span id="errorUserName"></span>
	                            </div>
	                            <div style="margin-top:10px;">
	                                <div style="float:left;">所在地区：&nbsp;&nbsp;</div>
	                                <?php echo CommonUtil::getCityDictHtml(); ?>
	                                <span id='errorAreaDict' ></span>
	                            </div>    
	                            <div style="margin-top:10px;">
	                                <div style="float:left;">收货地址：&nbsp;&nbsp;</div>
	                                <div style="float:left;">
	                                    <textarea id="addOtherAddress" rows="2" cols="35" name="addOtherAddress" style="*margin-left:-150px;" ></textarea>
	                                    <span id="errorOtherAddress"></span>
	                                </div>
	                                <div class="clear"></div>
	                            </div>
	                            <div style="margin-top:10px;">固定电话：&nbsp;&nbsp;<input id="addPhone" type="text" name="addPhone" /></div>
	                            <div style="margin-top:10px;">
	                                                                        手机：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	                                <input id="addMobileTelephone" type="text" name="addMobileTelephone" />
	                                <span id="errorMobilePhoneInfo"></span>
	                            </div>
	                            <div style="margin-top:10px;">
	                                                                        电子邮箱：&nbsp;
	                                <input id="addEmail" type="text" name="addEmail" />
	                                <span id="errorEmailInfo"></span>
	                            </div>
	                        </div>
                        <!-- 用户填写送货地址结束 -->
                            <div class="exchangeBtn">
                                <input type="button" value="兑换礼品" onclick="javascript:ExchangeContent.exchangeGift();;" />
                            </div>
                            
		                </div>
                        
                        <!-- 兑换抵用券开始 -->
		                <div class="exchangx_content" id="exchangxCoupon" style="display:none;margin-left:0px;margin-right:0px;width:610px;">
		                    <div style="font-size:50px;">
                            
	                            <div class="exchange_title">
	                                <div style="float:left;margin-left:50px;margin-top:8px;color:#000000;font-weight:bold">请选择</div>
	                                <div style="float:left;margin-left:230px;margin-top:8px;color:#000000;font-weight:bold;">优惠券描述</div>
	                                <div class="clear"></div>
	                            </div>
                                
                                <!-- 抵用券信息开始 -->
                                <?php 
                                    foreach ($promotionInfo as $key => $promotionItem) {
                                ?>
                                <div class="exchange_item" style="height:22px;">
	                                <div style="float:left;margin-left:60px;">
	                                    <?php 
	                                       if($key == 0){
	                                    ?>
                                        <input type="radio" name="exchangeCoupon" checked="checked" value="<?php echo $promotionItem["id"]."-".$promotionItem["min_ac_points"]."-".$promotionItem["exhaust_points"]."-".$promotionItem["short_description"]; ?>" />
                                        <?php }else{ ?>
                                        <input type="radio" name="exchangeCoupon" value="<?php echo $promotionItem["id"]."-".$promotionItem["min_ac_points"]."-".$promotionItem["exhaust_points"]."-".$promotionItem["short_description"]; ?>" />
	                                    <?php } ?>
                                    </div>
	                                <div style="float:left;margin-left:20px;">
	                                    <div style="text-align:center;width:500px;height:20px;line-height:20px;"><?php echo $promotionItem["short_description"]; ?></div>
	                                </div>
	                                <div class="clear"></div>
	                            </div>
                                <?php 
                                    } 
                                ?>
                                <!-- 抵用券信息结束 -->
                                
                            </div>
                            <div class="exchangeBtn" style="margin-left:50px;">
	                            <input type="button" value="兑换优惠券" onclick="javascript:ExchangeContent.exchangePromotion();" />
	                        </div>
		                </div>
		                <!-- 兑换抵用券结束 -->
                        
		            </div>
		            <!--选择兑换内容结束-->
		        </div>
		    </div>
		    </form>	    
            <!-- end -->
            </div> 
          </div>
          <?php 
            require_once '../app/views/FooterView.php';
            echo FooterView::getCommonFooterView();
         ?>   
         
         
            
            
    </body>
</html>